package com.example.projectdemo.Activity;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import com.example.projectdemo.R;
import com.example.projectdemo.config.DBOpenHelper;
import com.example.projectdemo.domain.Tea;
import com.example.projectdemo.domain.User;

import java.util.ArrayList;

public class OrdersActivity extends AppCompatActivity {
    private DBOpenHelper mDBOpenHelper;
    private TextView tv_order;
    private String str = "";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_orders);
        tv_order = findViewById(R.id.tv_order);
        //mDBOpenHelper = new DBOpenHelper(this);

        ArrayList<Tea> data = mDBOpenHelper.getAllData2();//data为获取的tea表内的tea信息
        for (int i = 0; i < data.size(); i++) {//遍历比较
            Tea tea = data.get(i);//获取data里的第i个tea信息
            str = str + tea;
        }

        //tv_order.setText(str.toString());
        tv_order.setText(str);
        findViewById(R.id.btn_3).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Toast.makeText(OrdersActivity.this, "支付成功", Toast.LENGTH_SHORT).show();
                finish();
            }
        });
    }
}